package com.tipcp.equip.collect.repository.impl;

import com.tipcp.equip.collect.domain.EquipEsModel;
import com.tipcp.equip.collect.repository.EquipRepository;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformation;
import org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EquipRepositoryImpl extends SimpleElasticsearchRepository<EquipEsModel,String> implements EquipRepository {
    @Resource
    private ElasticsearchRestTemplate template;


    public EquipRepositoryImpl(ElasticsearchEntityInformation<EquipEsModel, String> metadata, ElasticsearchOperations operations) {
        super(metadata, operations);
    }

    @Override
    public void saveAllWithIndex(List<EquipEsModel> models, String index) {
        template.save(models,index);
    }
}
